﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace SharpDiary.Core.Utility
{
    /// <summary>
    /// 提供一组用于显示弹出消息的方法。
    /// </summary>
    public class MessageBoxHelper
    {
        #region Fields & Properties

        #endregion

        #region Constructors

        static MessageBoxHelper() { }

        #endregion

        #region

        public static DialogResult ShowMessage(string text)
        {
            return MessageBox.Show(text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static DialogResult ShowAlert(string text)
        {
            return MessageBox.Show(text, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

        public static DialogResult ShowConfirmation(string text, bool showCancelButton)
        {
            return MessageBox.Show(text, "确认", showCancelButton ? MessageBoxButtons.YesNoCancel : MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
        }

        public static DialogResult ShowConfirmation(string text)
        {
            return ShowConfirmation(text, false);
        }

        public static void ShowException(Exception exception)
        {
            if (exception == null) { return; }
            MessageBox.Show(exception.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        #endregion
    }
}
